﻿<Window x:Class="IWMAG.Scripting.DevelopmentEnvironment.EditWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:editor="http://icsharpcode.net/sharpdevelop/avalonedit"
        Loaded="Window_Loaded"
    Title="(kodra || fogue(?) || slfiwmag) editor" Height="600" MinHeight="600" MinWidth="803" Width="803">
    <DockPanel TextElement.FontFamily="Segoe UI" TextElement.FontSize="16">
        <DockPanel DockPanel.Dock="Bottom">
            <DockPanel Margin="0,10,0,10" DockPanel.Dock="Bottom" HorizontalAlignment="Stretch">
                <Button DockPanel.Dock="Right" Margin="0,0,10,0" Name="btnRun" Click="btnRun_Click">
                    <Button.Style>
                        <Style>
                            <Style.Triggers>
                                <MultiDataTrigger>
                                    <MultiDataTrigger.Conditions>
                                        <Condition Binding="{Binding ElementName=tbCompilationStaus, Path=Opacity}" Value="0.7"/>
                                        <Condition Binding="{Binding ElementName=errLb, Path=Items.Count}" Value="0" />
                                    </MultiDataTrigger.Conditions>
                                    <MultiDataTrigger.Setters>
                                        <Setter Property="Button.Visibility" Value="Visible"/>
                                    </MultiDataTrigger.Setters>
                                </MultiDataTrigger>
                            </Style.Triggers>
                            <Setter Property="Button.Visibility" Value="Collapsed"/>
                        </Style>
                    </Button.Style>
                    Run
                </Button>
                <TextBlock Margin="10,0,10,0" VerticalAlignment="Center" DockPanel.Dock="Right" Name="tbCompilationStaus">Compiling</TextBlock>
                <Button Margin="10,0,0,0" Click="Button_Click">File a bug!</Button>
                <CheckBox Name="errsShowToggle" IsChecked="True" VerticalAlignment="Center" Margin="15,0,0,0">
                    <CheckBox.Style>
                        <Style>
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding ElementName=errLb, Path=Items.Count}" Value="0">
                                    <Setter Property="ToggleButton.IsEnabled" Value="False"/>
                                </DataTrigger>
                            </Style.Triggers>
                            <Setter Property="ToggleButton.IsEnabled" Value="True"/>
                        </Style>
                    </CheckBox.Style>
                    <TextBlock>
                       <TextBlock.Style>
                        <Style>
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding ElementName=errLb, Path=Items.Count}" Value="0">
                                    <Setter Property="TextBlock.Text" Value="Error List empty =)"/>
                                </DataTrigger>
                                <DataTrigger Binding="{Binding ElementName=errLb, Path=Items.Count}" Value="1">
                                    <Setter Property="TextBlock.Text" Value="Error List (1 Item)"/>
                                </DataTrigger>
                            </Style.Triggers>
                            <Setter Property="TextBlock.Text" Value="{Binding ElementName=errLb, Path=Items.Count, StringFormat='Show Error List ({0} Items)'}"/>
                        </Style>
                    </TextBlock.Style>
                    </TextBlock>
                </CheckBox>
            </DockPanel>
            <ListBox MaxHeight="200" Name="errLb" SelectionMode="Single"  Margin="0,0,0,0">
                <ListBox.Style>
                    <Style>
                        <Style.Triggers>
                            <MultiDataTrigger>
                                <MultiDataTrigger.Conditions>
                                    <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=Items.Count}" Value="0" />
                                </MultiDataTrigger.Conditions>
                                <MultiDataTrigger.Setters>
                                    <Setter Property="ListBox.Visibility" Value="Collapsed" />
                                </MultiDataTrigger.Setters>
                            </MultiDataTrigger>
                            <MultiDataTrigger>
                                <MultiDataTrigger.Conditions>
                                    <Condition Binding="{Binding ElementName=errsShowToggle, Path=IsChecked}" Value="False"/>
                                </MultiDataTrigger.Conditions>
                                <MultiDataTrigger.Setters>
                                    <Setter Property="ListBox.Visibility" Value="Collapsed" />
                                </MultiDataTrigger.Setters>
                            </MultiDataTrigger>
                        </Style.Triggers>
                        <Setter Property="ListBox.Visibility" Value="Visible" />
                    </Style>
                </ListBox.Style>
            </ListBox>
        </DockPanel>
        <Grid >
            <editor:TextEditor Name="mainEditor" ShowLineNumbers="True">

            </editor:TextEditor>
        </Grid>
    </DockPanel>
</Window>
